import { BaseEntity } from '../../base/entity/base';
import { Column, Entity, Index } from 'typeorm';

/**
 * 供应商合同
 */
@Entity('supplier_contract')
export class SupplierContractEntity extends BaseEntity {
  @Index()
  @Column({ comment: '供应商ID' })
  supplierId: number;

  @Column({ comment: '合同名称', length: 255 })
  name: string;

  @Column({
    comment: '合同类型',
    dict: ['框架合同', '采购订单', '服务协议'],
    default: 0,
  })
  type: number;

  @Column({ comment: '开始日期', type: 'date' })
  startDate: Date;

  @Column({ comment: '结束日期', type: 'date' })
  endDate: Date;

  @Column({ comment: '合同金额', type: 'decimal', precision: 10, scale: 2 })
  amount: number;

  @Column({
    comment: '状态',
    dict: ['未生效', '生效中', '已到期', '终止'],
    default: 0,
  })
  status: number;

  @Column({ comment: '附件', nullable: true })
  attachmentUrl: string;
}
